home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c++,comp.lang.c,comp.std.c
- Subject: Re: Hungarian notation
- Date: 27 Jan 1996 12:46:50 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4edruq$s6h@solutions.solon.com>
- References: <30C40F77.53B5@swsbbs.com> <4eco1g$aih@fountain.mindlink.net> <4ecqkn$p1t@solutions.solon.com> <4edore$sh1@fountain.mindlink.net>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4edore$sh1@fountain.mindlink.net>,
- Gene Wirchenko <genew@mindlink.bc.ca> wrote:
- >>My understanding is that integer conversions are an implementation
- >>defined *RESULT*. No other *behavior* is allowed - the semantics do
- >>not imply or show any.
-
- > Is this defined in the Standard?
-
- !
- Not that I can find; perhaps this is a bug.
-
- >>However, given something where the *result* is implementation defined, I
- >>would expect that no unexpected *behavior* was allowed.
-
- > A result is a behavior, no?
- > Gah, the arguments over wording. Next: "How many angel can dance
- >on the end of a C pointer?"
-
- No; a result of type int is some value representable in type int; a
- behavior is not constrained to be that limited.
-
- This is probably a standard weakness; it simply assumes that people will
- distinguish between implementation defined behavior (the contents and
- interpretation of the string passed to the system function) and
- implementation defined behavior (whether a plain char has the same range
- of values as signed or unsigned char.) The latter implicitly provides
- room for only two answers - signed or unsigned. Similarly, when they
- say a "result" is imp. defined, we generally assume they mean "the
- result of the expression", because that's how it would work if they were
- speaking English, in context.
-
- (Several other things define the "result" of an expression.)
-
- >>Because none are specified. The semantics of the >> operator on signed
- >>ints are implementation specified (or is that defined?) but no one would
- >>tolerate it formatting disks, because it doesn't say it can, and the
- >>wording makes it clear that no extra behavior is expected.
-
- > Doesn't none specified mean that the implementation is free to
- >play hopscotch with nasal demons?
-
- No.
-
- When *no behavior at all* is specified, you get undefined behavior.
-
- When *ANY* behavior at all is specified, it is assumed to be exhaustive.
- For instance, when the Standard says "free(NULL) has no effect", we do
- not consider it acceptable for it to have no effect, and to *also* crash
- the computer. The behavior listed is presumed exhaustive unless stated
- otherwise.
-
- > My point is that if the value can't be represented then it's
- >hardly the case that a conversion is being performed. If you consider
- >butchering a value to an implementation defined value to be
- >conversion, gah.
-
- Well, the conversion is a source-level detail.
- Given
- int i;
- char ch;
- we call
- ch = i;
- an implicit conversion, and
- ch = (char) i;
- an explicit conversion.
-
- That's a conversion; whether the *result* is meaningful or not may vary.
- If i's value fits in a char, we are told the result will be meaningful.
- If it won't, we are told the implementation will give us rules for it.
- This doesn't sound like the implementation is allowed to define rules
- for anything beyond what the correlation of char to int values is.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- Using trn? Weird new newsgroup problem? I know the fix! Email me!
- The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
-